package test;

import java.util.StringJoiner;

public class test15StringJoiner {
    public static void main(String[] args) {
        //jdk8往后
        //Stringjoiner用法
        //1.没有空参
        //2.delimiter,插入元素,prefix,往前，开始，suffix,结束
        StringJoiner sj=new StringJoiner(",","[","]");
        //add添加元素
            sj.add("1").add("2").add("3");
        //转化字符串
        String string = sj.toString();
        System.out.println(string);

    }
}
